/**
 * 
 */
var audio = function (){
	this.src;
	this.src1;
	this.maxvalue=1;
	this.minvalue=0;
	this.soundad =0.025;
	this.locsound=true;
	this.x =0;
	this.y =0;
	
	this.player = document.createElement('AUDIO');
	this.player.controls = false;

}


audio.prototype.init = function(){
	this.player.src = this.src;
	this.player.autoplay = true;
	if (this.player.maxvalue>1) this.player.maxvalue =1;
}

audio.prototype.play = function (){ 
	this.player.play();
}

audio.prototype.stop = function (){ 
	this.player.pause();
}

audio.prototype.sound3d = function (ax,ay){ 
	if (!this.locsound) return;
	val =( Math.abs(ax - this.x) + Math.abs(ay - this.y) )/1.4;
	val = this.maxvalue- this.soundad*val;
	if (val < this.minvalue) val =this.minvalue;
	this.player.volume = val;
}

